package cn.usian.service.impl;

import cn.usian.dao.DishFlavorMapper;
import cn.usian.entity.DishFlavor;
import cn.usian.service.DishFlavorService;
import cn.usian.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.time.LocalDateTime;

@Service
public class DishFlavorServiceImpl implements DishFlavorService {
    @Autowired
    private DishFlavorMapper dishFlavorMapper;

    @Override
    public void add(DishFlavor dishFlavor, HttpSession session) {
        Long id = (Long) session.getAttribute("employee");
        dishFlavor.setCreateTime(LocalDateTime.now());
        dishFlavor.setUpdateTime(LocalDateTime.now());
        dishFlavor.setCreateUser(id);
        dishFlavor.setUpdateUser(id);
        dishFlavorMapper.insert(dishFlavor);
    }
}
